{template header}
{if $tips}
<div class="alert">{$tips}<a class="close" data-dismiss="alert" href="#">&times;</a></div>
{else}
<script src="static/bootstrap/js/utils.js"></script>
<link rel="stylesheet" href="static/calendar/js/calendar.css" />
<script type="text/javascript" charset="utf-8" src="static/calendar/calendar.php"></script>
<style type="text/css">
  .pushUrl{margin: 10px auto;}
  .pushUrl li{list-style-type: none; float: left; margin: 2px 5px;background-color:#dbeaf9;padding:5px;cursor: pointer;}
</style>
<script type="text/javascript">
  $(document).ready(function(){
      $("#pushUrl>li").click(function()
      {
         url = $(this).attr("data-url");
         message = $(this).attr("alert-mes");
         $("#pushUrl>li").each(function(){
            $(this).css("background-color", "#dbeaf9");
          });
         $("#jumpUrl").val(url);
         $(this).css("background-color", "yellow");
         if(!Utils.isEmpty(message)){
            alert(message);
         }
      });
    });
</script>
<form class="form-horizontal" action="index.php?c=admin&a=msgPushInfo" method="post">
  <div class="control-group">
    <label class="control-label" for="inputShortDesc">要推送的设备类型：</label>
    <div class="controls">
      <select name="device_type">
        <option {if $detail['device_type'] == '0'} selected="selected" {/if} value="0">全部</option>
        <option {if $detail['device_type'] == '1'} selected="selected" {/if} value="1">安卓</option>
        <option {if $detail['device_type'] == '2'} selected="selected" {/if} value="2">ios</option>
      </select>
      <div style="float:right;display:inline-block;margin-right:600px;">
        <input type="checkbox" name="is_sound" {if $detail['is_sound'] == 1} checked="checked" {/if}>
        &nbsp; 声音提醒
    </div>
    </div>
  </div>
  <div class="control-group">
    <label class="control-label" for="inputTiltle">安卓：</label>
    <div class="controls">
      <div class="control-group">
        <div class="">
          <input type="text" name='title' placeholder="请输入安卓消息标题" value="{$detail['title']}">
        </div>
      </div>
      <div class="control-group">
        <div class="">
          <textarea name="android_message" placeholder="请输入安卓消息内容" style="min-width:80%; min-height:200x;">{$detail['android_message']}</textarea>
        </div>
      </div>
    </div>
    <div class="control-group">
        <div class="controls">
          <span>安卓测试设备：</span>
          <textarea name="android_test" placeholder="请输入要测试推送的安卓设备, 多个设备以'|'分隔" style="min-width:60%; min-height:200x;">{$detail['android_test']}</textarea>
        </div>
      </div>
  </div>
  <div class="control-group">
    <label class="control-label" for="inputTiltle">IOS：</label>
      <div class="control-group">
        <div class="controls">
          <textarea name="ios_message" placeholder="请输入IOS消息内容" style="min-width:80%; min-height:200x;">{$detail['ios_message']}</textarea>
        </div>
        <div class="controls">
          <span>苹果测试设备：</span>
          <textarea name="ios_test" placeholder="请输入要测试推送的IOS设备号, 多个设备以'|'分隔" style="min-width:60%; min-height:200x;">{$detail['ios_test']}</textarea>
        </div>
    </div>
  </div>
  <div class="control-group">
    <label class="control-label" for="inputShortDesc">推送定时：</label>
    <div class="controls">
      <input type="text" name="send_time" readonly="readonly" id="send_time_id" value="{eval echo date('Y-m-d H:i:s', $detail['send_time'])}">
      <input name="send_time_btn" type="button" id="send_time_btn" onclick="return showCalendar('send_time_id', '%Y-%m-%d %H:%M:%S', '24', false, 'send_time_btn');" value="选择" class="button" id="send_time_id"/>
    </div>
  </div>
  <div class="control-group">
    <label class="control-label" for="inputShortDesc">跳转URL：</label>
    <div class="controls">
      <input name="url" type="text" id="jumpUrl" placeholder="跳转URL" value="{$detail['url']}" style="width:400px;">
      <ul id="pushUrl" class="pushUrl">
      {loop $msgTypeUrlArray $k $v}
        <li data-url="{$v['url']}" alert-mes="{$v['message']}">{$v['name']}</li>
      {/loop}
      </ul>
    </div>
  </div>
  <div class="control-group">
      <label class="control-label" for="name">性别 </label>
      <div class="controls">
          <select name="gender">
              <option value="0" {if $detail['gender']==0}selected{/if}>不限</option>
              <option value="1" {if $detail['gender']==1}selected{/if}>男</option>
              <option value="2" {if $detail['gender']==2}selected{/if}>女</option>
          </select>
      </div>
  </div>
  <div class="control-group">
      <label class="control-label" for="name">城市 </label>
      <div class="controls">
          <input class="input-lg" name="city" type="text" placeholder="" value="{$detail['city']}">
      </div>
  </div>
  <div class="control-group">
      <label class="control-label" for="name">用户ID </label>
      <div class="controls">
          <textarea name="uids" placeholder="输入要推送的用户ID，多个ID以'|'分隔，输入后只对相应ID的用户推送">{$detail['uids']}</textarea>
      </div>
  </div>
  <div class="control-group">
    <div class="controls">
        <input type="hidden" name="msg_id" value="{$detail['msg_id']}">
        {if $handletype == 'add'}
          <input type="hidden" name="handletype" value="insert">
        {elseif $handletype == 'edit'}
          <input type="hidden" name="handletype" value="update">
        {/if}
        <button type="submit" class="btn"{if $detail['status'] != 0} disabled="disabled"{/if}>提交</button>
        &nbsp;
        <input type="reset" class="btn" value="重置">
    </div>
  </div>
</form>
{/if}
{template footer}